package br.com.edoc.util;



import java.util.Properties;

import br.com.edoc.conf.EmailSistema;

public class EmailUtil {
	public static final Properties getProperties(EmailSistema email){
		
		Properties props = new Properties();
		props.put("mail.transport.protocol", email.getProtocolo()); //define protocolo de envio como SMTP
		props.put("mail.smtp.starttls.enable","true"); 
		props.put("mail.smtp.host", email.getServidor()); //server SMTP do GMAIL
		props.put("mail.smtp.auth", (email.getAutenticacao())?"true":"false"); //ativa autenticacao
		props.put("mail.smtp.user", email.getEmailSistema()); //usuario ou seja, a conta que esta enviando o email (tem que ser do GMAIL)
		props.put("mail.debug", (email.getDebug())?"true":"false");
		props.put("mail.smtp.port", email.getPorta()); //porta
		props.put("mail.smtp.socketFactory.port",email.getPorta()); //mesma porta para o socket
		props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
		props.put("mail.smtp.socketFactory.fallback", "false");
		return props;
		
	}
}
